<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<style type="text/css">
			.green{
				background-color: #00ff7f;
				width: 100;
			}
			.blue{
				background-color: #0056B3;
				width: 100;
			}
			span{
				background-color: #ffff7f;
				padding: 8px;
				margin: 5px;
				float: left;
			}
		</style>
	</head>
	<body>
		<!-- remove()删除元素及其对应子元素，标签和内容一起删除
			指定元素.remove();
			empty()清空
		 
		 -->
		 <h3删除元素></h3>
		 <span class="green">jquery<a>删除</a></span><br>
		 <span class="blue">javase</span><br>
		 <span class="green">http协议</span><br>
		 <span class="blue">servlet</span><br>
		 <button type="button" id="btn1">remove绿色</button>
		 <button type="button" id="btn2">empty蓝色</button>
	</body>
	<script src="js/jquery-3.5.1.js" type="text/javascript" charset="utf-8"></script>
	<script type="text/javascript">
		$("#btn1").click(function(){
			$(".green").remove();
		});
		
		$("#btn2").click(function(){
			$(".blue").empty();
		});
		$("span").each(function(index,element){
			console.log(index);
			console.log(element);
			console.log($(this));
			console.log($(element));
		});
		
	</script>
</html>
